package com.example.hospitaldemo.mapper;

import com.example.hospitaldemo.entity.Ward;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 科室表 Mapper 接口
 * </p>
 *
 * @author 张三
 * @since 2024-12-16
 */
public interface WardMapper extends BaseMapper<Ward> {
    /**
     * 一对多，科室对床位
     *      应用于入院登记
     */
    @Select("select * from ward")
    @Results({
            @Result(column = "name",property = "name"),
            @Result(column = "id",property = "id"),
            @Result(column = "id",property = "zhiliaoshiList",
                    many = @Many(select = "com.example.hospitaldemo.mapper.ZhiliaoshiMapper.getZhiliaoshiInWard")),
    })
    List<Ward> getZhiliaoshiInWard();
}
